package org.example.benchmarkTest;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.ArrayList;
import java.util.List;

public class HeapOomTest {
   private static final Logger LOGGER = LoggerFactory.getLogger(HeapOomTest.class);

   private static List<byte[]> CACHE = new ArrayList<>(1000);

   public static void main(String[] args) {
      for (int loopTimes = 1; loopTimes < 20; loopTimes++) {
         LOGGER.info("第 {} 次循环前", loopTimes);
         // 每次占用5M内存
         CACHE.add(new byte[5 * 1024 * 1024]);
      }
   }
}
